'''
历史记录锁定/解锁接口
2是锁定  1是解锁
"fileId": 732 --- 对应的任务名称是----jobName: "周期任务--每周一到周五下午2:15起飞"
'''
import allure
import requests
import conftest
from common.logger import Log



class Test_getRecord():

    def setup_method(self):
        # 定义登录接口URL地址
        self.editFileStatus_url = "http://192.168.3.182:9990/airservice-device/media/editFileStatus"
        #实例化日志模块
        self.log = Log("历史记录锁定接口").get_logger()


    @allure.step(title="锁定")
    def test_editFileStatus_case01(self):
        self.editFileStatus_data={
                                    "fileId": 732,
                                    "fileStatus": 1
                                }
        response = requests.post(url=self.editFileStatus_url, json=self.editFileStatus_data, headers=conftest.headers_data)

        #添加断言
        assert response.json().get("message") == "success"
        assert  response.json().get("success") == True

        #打印日志
        self.log.info("锁定历史记录：{}".format(response.json()))

    @allure.step(title="取消锁定")
    def test_editFileStatus_case02(self):
        self.editFileStatus_data={
                                        "recordId": 335,
                                        "favorited":0
                                    }
        response = requests.post(url=self.editFileStatus_url, json=self.editFileStatus_data, headers=conftest.headers_data)

        #添加断言
        assert response.json().get("message") == "success"
        assert  response.json().get("success") == True

        #打印日志
        self.log.info("取消锁定历史记录：{}".format(response.json()))

